[1] 4.12 4.57 5.00 17.00
Spring 2026
Data are a means to represent the world
| Type | Definition | Example |
|---|---|---|
| Double | Whole or floating number | 5 or 5.73 |
| Integer | Whole number | 5, 2, 3L |
| Character | Individual or strings of non-numbers | “c”, “cat”, “cat in the hat” |
| Factor | Categorical or discrete variables | M/F, S/M/L |
| Boolean | Binary Categories | T/F |
Numbers
[1] 4.12 4.57 5.00 17.00
Characters
[1] "M" "male" "F" "cat" "Cat-Dog"
Factors
[1] M M F M
Levels: F M
Boolean
[1] TRUE FALSE TRUE FALSE
NULL
[1] NA
[1] NaN
[1] Inf
Each variable / object has a data mode that umbrellas by data type.
Rows: 949
Columns: 22
$ id <dbl> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,…
$ pokemon <chr> "bulbasaur", "ivysaur", "venusaur", "charmander", "cha…
$ species_id <dbl> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,…
$ height <dbl> 0.7, 1.0, 2.0, 0.6, 1.1, 1.7, 0.5, 1.0, 1.6, 0.3, 0.7,…
$ weight <dbl> 6.9, 13.0, 100.0, 8.5, 19.0, 90.5, 9.0, 22.5, 85.5, 2.…
$ base_experience <dbl> 64, 142, 236, 62, 142, 240, 63, 142, 239, 39, 72, 178,…
$ type_1 <chr> "grass", "grass", "grass", "fire", "fire", "fire", "wa…
$ type_2 <chr> "poison", "poison", "poison", NA, NA, "flying", NA, NA…
$ hp <dbl> 45, 60, 80, 39, 58, 78, 44, 59, 79, 45, 50, 60, 40, 45…
$ attack <dbl> 49, 62, 82, 52, 64, 84, 48, 63, 83, 30, 20, 45, 35, 25…
$ defense <dbl> 49, 63, 83, 43, 58, 78, 65, 80, 100, 35, 55, 50, 30, 5…
$ special_attack <dbl> 65, 80, 100, 60, 80, 109, 50, 65, 85, 20, 25, 90, 20, …
$ special_defense <dbl> 65, 80, 100, 50, 65, 85, 64, 80, 105, 20, 25, 80, 20, …
$ speed <dbl> 45, 60, 80, 65, 80, 100, 43, 58, 78, 45, 30, 70, 50, 3…
$ color_1 <chr> "#78C850", "#78C850", "#78C850", "#F08030", "#F08030",…
$ color_2 <chr> "#A040A0", "#A040A0", "#A040A0", NA, NA, "#A890F0", NA…
$ color_f <chr> "#81A763", "#81A763", "#81A763", NA, NA, "#DE835E", NA…
$ egg_group_1 <chr> "monster", "monster", "monster", "monster", "monster",…
$ egg_group_2 <chr> "plant", "plant", "plant", "dragon", "dragon", "dragon…
$ url_icon <chr> "//archives.bulbagarden.net/media/upload/7/7b/001MS6.p…
$ generation_id <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, …
$ url_image <chr> "https://raw.githubusercontent.com/HybridShivam/Pokemo…
mode.Vectors combined together.
| pokemon | type_1 | type_2 |
|---|---|---|
| bulbasaur | grass | poison |
| ivysaur | grass | poison |
| venusaur | grass | poison |
| charmander | fire | NA |
| charmeleon | fire | NA |
| charizard | fire | flying |
| pokemon | type_1 | hp |
|---|---|---|
| bulbasaur | grass | 45 |
| ivysaur | grass | 60 |
| venusaur | grass | 80 |
function for that!R is a computer programming language
Languages have dialects
library()You have to walk before you can run… we will start with base…
Remember R can only do what you ask it! It is hyper literal
head(x, n=6): return the first n elementstail(x, n=6): return the last n elements| id | pokemon | species_id | height | weight | base_experience | type_1 | type_2 | hp | attack | defense | special_attack | special_defense | speed | color_1 | color_2 | color_f | egg_group_1 | egg_group_2 | url_icon | generation_id | url_image |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | bulbasaur | 1 | 0.7 | 6.9 | 64 | grass | poison | 45 | 49 | 49 | 65 | 65 | 45 | #78C850 | #A040A0 | #81A763 | monster | plant | //archives.bulbagarden.net/media/upload/7/7b/001MS6.png | 1 | https://raw.githubusercontent.com/HybridShivam/Pokemon/master/assets/images/001.png |
| 2 | ivysaur | 2 | 1.0 | 13.0 | 142 | grass | poison | 60 | 62 | 63 | 80 | 80 | 60 | #78C850 | #A040A0 | #81A763 | monster | plant | //archives.bulbagarden.net/media/upload/a/a0/002MS6.png | 1 | https://raw.githubusercontent.com/HybridShivam/Pokemon/master/assets/images/002.png |
| 3 | venusaur | 3 | 2.0 | 100.0 | 236 | grass | poison | 80 | 82 | 83 | 100 | 100 | 80 | #78C850 | #A040A0 | #81A763 | monster | plant | //archives.bulbagarden.net/media/upload/0/07/003MS6.png | 1 | https://raw.githubusercontent.com/HybridShivam/Pokemon/master/assets/images/003.png |
| id | pokemon | species_id | height | weight | base_experience | type_1 | type_2 | hp | attack | defense | special_attack | special_defense | speed | color_1 | color_2 | color_f | egg_group_1 | egg_group_2 | url_icon | generation_id | url_image |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 10146 | kommo-o-totem | 784 | 2.4 | 207.5 | 270 | dragon | fighting | 75 | 110 | 125 | 100 | 105 | 85 | #7038F8 | #C03028 | #8336C5 | dragon | NA | NA | NA | https://raw.githubusercontent.com/HybridShivam/Pokemon/master/assets/images/10146.png |
| 10147 | magearna-original | 801 | 1.0 | 80.5 | 120 | steel | fairy | 80 | 95 | 115 | 130 | 115 | 65 | #B8B8D0 | #EE99AC | #C5B0C7 | no-eggs | NA | NA | NA | https://raw.githubusercontent.com/HybridShivam/Pokemon/master/assets/images/10147.png |
dim(x): return the dimensions of an object
spc_tbl_ [949 × 22] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
$ id : num [1:949] 1 2 3 4 5 6 7 8 9 10 ...
$ pokemon : chr [1:949] "bulbasaur" "ivysaur" "venusaur" "charmander" ...
$ species_id : num [1:949] 1 2 3 4 5 6 7 8 9 10 ...
$ height : num [1:949] 0.7 1 2 0.6 1.1 1.7 0.5 1 1.6 0.3 ...
$ weight : num [1:949] 6.9 13 100 8.5 19 90.5 9 22.5 85.5 2.9 ...
$ base_experience: num [1:949] 64 142 236 62 142 240 63 142 239 39 ...
$ type_1 : chr [1:949] "grass" "grass" "grass" "fire" ...
$ type_2 : chr [1:949] "poison" "poison" "poison" NA ...
$ hp : num [1:949] 45 60 80 39 58 78 44 59 79 45 ...
$ attack : num [1:949] 49 62 82 52 64 84 48 63 83 30 ...
$ defense : num [1:949] 49 63 83 43 58 78 65 80 100 35 ...
$ special_attack : num [1:949] 65 80 100 60 80 109 50 65 85 20 ...
$ special_defense: num [1:949] 65 80 100 50 65 85 64 80 105 20 ...
$ speed : num [1:949] 45 60 80 65 80 100 43 58 78 45 ...
$ color_1 : chr [1:949] "#78C850" "#78C850" "#78C850" "#F08030" ...
$ color_2 : chr [1:949] "#A040A0" "#A040A0" "#A040A0" NA ...
$ color_f : chr [1:949] "#81A763" "#81A763" "#81A763" NA ...
$ egg_group_1 : chr [1:949] "monster" "monster" "monster" "monster" ...
$ egg_group_2 : chr [1:949] "plant" "plant" "plant" "dragon" ...
$ url_icon : chr [1:949] "//archives.bulbagarden.net/media/upload/7/7b/001MS6.png" "//archives.bulbagarden.net/media/upload/a/a0/002MS6.png" "//archives.bulbagarden.net/media/upload/0/07/003MS6.png" "//archives.bulbagarden.net/media/upload/7/7d/004MS6.png" ...
$ generation_id : num [1:949] 1 1 1 1 1 1 1 1 1 1 ...
$ url_image : chr [1:949] "https://raw.githubusercontent.com/HybridShivam/Pokemon/master/assets/images/001.png" "https://raw.githubusercontent.com/HybridShivam/Pokemon/master/assets/images/002.png" "https://raw.githubusercontent.com/HybridShivam/Pokemon/master/assets/images/003.png" "https://raw.githubusercontent.com/HybridShivam/Pokemon/master/assets/images/004.png" ...
- attr(*, "spec")=
.. cols(
.. id = col_double(),
.. pokemon = col_character(),
.. species_id = col_double(),
.. height = col_double(),
.. weight = col_double(),
.. base_experience = col_double(),
.. type_1 = col_character(),
.. type_2 = col_character(),
.. hp = col_double(),
.. attack = col_double(),
.. defense = col_double(),
.. special_attack = col_double(),
.. special_defense = col_double(),
.. speed = col_double(),
.. color_1 = col_character(),
.. color_2 = col_character(),
.. color_f = col_character(),
.. egg_group_1 = col_character(),
.. egg_group_2 = col_character(),
.. url_icon = col_character(),
.. generation_id = col_double(),
.. url_image = col_character()
.. )
- attr(*, "problems")=<externalptr>
| id | pokemon | species_id | height | weight | base_experience | type_1 | type_2 | hp | attack | defense | special_attack | special_defense | speed | color_1 | color_2 | color_f | egg_group_1 | egg_group_2 | url_icon | generation_id | url_image |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | bulbasaur | 1 | 0.7 | 6.9 | 64 | grass | poison | 45 | 49 | 49 | 65 | 65 | 45 | #78C850 | #A040A0 | #81A763 | monster | plant | //archives.bulbagarden.net/media/upload/7/7b/001MS6.png | 1 | https://raw.githubusercontent.com/HybridShivam/Pokemon/master/assets/images/001.png |
| 2 | ivysaur | 2 | 1.0 | 13.0 | 142 | grass | poison | 60 | 62 | 63 | 80 | 80 | 60 | #78C850 | #A040A0 | #81A763 | monster | plant | //archives.bulbagarden.net/media/upload/a/a0/002MS6.png | 1 | https://raw.githubusercontent.com/HybridShivam/Pokemon/master/assets/images/002.png |
| 3 | venusaur | 3 | 2.0 | 100.0 | 236 | grass | poison | 80 | 82 | 83 | 100 | 100 | 80 | #78C850 | #A040A0 | #81A763 | monster | plant | //archives.bulbagarden.net/media/upload/0/07/003MS6.png | 1 | https://raw.githubusercontent.com/HybridShivam/Pokemon/master/assets/images/003.png |
summary() returns the summary statistics for an object.names(): Dataframe or listcolnames(): Dataframe or matrix [1] "id" "pokemon" "species_id" "height"
[5] "weight" "base_experience" "type_1" "type_2"
[9] "hp" "attack" "defense" "special_attack"
[13] "special_defense" "speed" "color_1" "color_2"
[17] "color_f" "egg_group_1" "egg_group_2" "url_icon"
[21] "generation_id" "url_image"
NB: These can be useful to get index values of columns.
Remember, a column of data is a vector with 1 mode.
dat[,5]$ - e.g., dat$hpdat[[9]] or dat[["hp"]]
dat[,5] but it will return a dataframe and not a vector.[1] "bulbasaur" "ivysaur" "venusaur" "charmander" "charmeleon"
[6] "charizard"
Maintains dataframe-ness or matrix shape
[ ] height weight base_experience type_1
Min. : 0.100 Min. : 0.10 Min. : 36.0 Length:949
1st Qu.: 0.500 1st Qu.: 8.50 1st Qu.: 68.0 Class :character
Median : 1.000 Median : 28.80 Median :157.0 Mode :character
Mean : 1.228 Mean : 66.21 Mean :150.5
3rd Qu.: 1.500 3rd Qu.: 66.60 3rd Qu.:184.0
Max. :14.500 Max. :999.90 Max. :608.0
height weight base_experience type_1
Min. : 0.100 Min. : 0.10 Min. : 36.0 water :126
1st Qu.: 0.500 1st Qu.: 8.50 1st Qu.: 68.0 normal :111
Median : 1.000 Median : 28.80 Median :157.0 grass : 84
Mean : 1.228 Mean : 66.21 Mean :150.5 bug : 79
3rd Qu.: 1.500 3rd Qu.: 66.60 3rd Qu.:184.0 rock : 65
Max. :14.500 Max. :999.90 Max. :608.0 psychic: 64
(Other):420
names() or colnames(). [1] "id" "pokemon" "species_id" "height"
[5] "weight" "base_experience" "type_1" "type_2"
[9] "hp" "attack" "defense" "special_attack"
[13] "special_defense" "speed" "color_1" "color_2"
[17] "color_f" "egg_group_1" "egg_group_2" "url_icon"
[21] "generation_id" "url_image"
[1] "id" "pokemon" "species_id" "height"
[5] "WT" "base_experience" "type_1" "type_2"
[9] "hp" "attack" "defense" "special_attack"
[13] "special_defense" "speed" "color_1" "color_2"
[17] "color_f" "egg_group_1" "egg_group_2" "url_icon"
[21] "generation_id" "url_image"
[1] "id" "pokemon" "species_id" "HT"
[5] "WGT" "EXP" "type_1" "type_2"
[9] "hp" "attack" "defense" "special_attack"
[13] "special_defense" "speed" "color_1" "color_2"
[17] "color_f" "egg_group_1" "egg_group_2" "url_icon"
[21] "generation_id" "url_image"
[1] "id" "pokemon" "species_id" "HT"
[5] "WGT" "EXP" "type_1" "type_2"
[9] "HP" "attack" "DEF" "special_attack"
[13] "special_defense" "SPD" "color_1" "color_2"
[17] "color_f" "egg_group_1" "egg_group_2" "url_icon"
[21] "generation_id" "url_image"
rbind() combines data vertically
rbind will work if columns are out of order but the number is the same. It is up to the User to ensure they match.cbind() combines data horizontally
[1] "pokemon" "type_1"
[1] "HT" "WGT" "EXP"
Sex + PopulationAge_Group + Political_Party[1] "pokemon" "type_1" "name_type"